<?php
class GoodsAction extends FrontendAction
{
    public function _initialize()
	{
		$this->curr_nav = 'goods';
		parent::_initialize();
	}

    public function index()
    {
        $item_mod = D('Item');
    	import("ORG.Util.Page");
    	$total_nums = $item_mod->count();
		$pager = new Page($total_nums, 20);
		$item_list = $item_mod->limit($pager->firstRow.','.$pager->listRows)->findAll();
		$this->assign('page',$pager->show());
		$this->assign('item_list',$item_list);
        $this->display('list');
    }

    public function view()
    {
        $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : $this->error('参数错误');
        $item_info = D('Item')->where('id='.$id)->find();
        $this->assign('item_info', $item_info);
        $this->display();
    }
}
?>